#ifndef OPEN_SCENE_GRAPH_WIDGET_H
#define OPEN_SCENE_GRAPH_WIDGET_H

#include <osg/ref_ptr>
#include <QOpenGLWidget>

namespace osgGA
{
    class EventQueue;
}

namespace osgViewer
{
    class Viewer;
    class GraphicsWindowEmbedded;
}

class QEvent;
class QMouseEvent;

class OpenSceneGraphWidget : public QOpenGLWidget
{
public:
    OpenSceneGraphWidget(QWidget *parent = nullptr);

    ~OpenSceneGraphWidget();

protected:
    virtual void initializeGL() override;

    virtual void paintGL() override;

    virtual void resizeGL(int width, int height) override;

    virtual void mouseMoveEvent(QMouseEvent *event) override;

    virtual void mousePressEvent(QMouseEvent *event) override;

    virtual void mouseReleaseEvent(QMouseEvent *event) override;

    virtual void wheelEvent(QWheelEvent *event) override;

    virtual bool event(QEvent *event) override;

private:
    osgGA::EventQueue *getEventQueue() const;

private:
    qreal                                           m_scale;
    osg::ref_ptr<osgViewer::Viewer>                 m_viewer;
    osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_graphicsWindow;
};


#endif // OPEN_SCENE_GRAPH_WIDGET_H


